<script setup lang="tsx">
import type { MaybeRef } from '@vueuse/core'
import type { PropType } from 'vue'
import type { DescriptionsSchema } from '../../Descriptions'
import { useAttrs } from 'vue'
import { Descriptions } from '../../Descriptions'

defineOptions({
  name: 'Detail',
})

defineProps({
  currentRow: {
    type: Object as PropType<any>,
    default: () => null,
  },
  detailSchema: {
    type: Array as PropType<MaybeRef<DescriptionsSchema[]>>,
    default: () => [],
  },
})

const attrs = useAttrs()
</script>

<template>
  <Descriptions
    :schema="detailSchema"
    :data="currentRow || {}"
    v-bind="attrs"
  >
    <template #extra>
      <slot name="extra" />
    </template>
  </Descriptions>
</template>
